Routines (alphabetical) > Routines: I > ISHFT

ISHFT

Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The ISHFT function performs the bit shift operation on bytes, integers and longwords.

Syntax

Result = ISHFT(P1, P2)

Return Value

If P2 is positive, P1 is left shifted P2 bit positions with 0 bits filling vacated positions. If P2 is negative, P1 is right shifted with 0 bits filling vacated positions.

Arguments

P1

The scalar or array to be shifted.

P2

The scalar or array containing the number of bit positions and direction of the shift.

Keywords

Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Examples

Bit shift each element of the integer array [1, 2, 3, 4, 5] three bits to the left and store the result in B by entering:

B = ISHFT([1,2,3,4,5], 3)

The resulting array B is [8, 16, 24, 32, 40].

Version History

Original

Introduced

See Also

SHIFT